package com.kwq.designPattern.construct.proxy;

import lombok.Data;

/**
 * @author kangwanqiang
 * @date 2021/2/9
 * @description 代理对象
 */
@Data
public class ProxyImage implements Image{
    private RealImage realImage;
    private String fileName;

    public ProxyImage(String fileName){
        this.fileName = fileName;
    }

    @Override
    public void display() {
        if(realImage == null){
            realImage = new RealImage(fileName);
        }
        realImage.display();
    }
}
